/*
 *  $Id: Draconnar.cs 1067 2010-05-21 11:00:43Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Neutral.Lands {
    public class Draconnar: LandCard {
        public Draconnar(): base("001_n_l_draconnar") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Neutral;
            Value = 100;
            AddCondition(HandCardsCondition.OwnRelease(6));
        }

        public override void SetNaturalAffects(ICollector<Affect> affects) {
            affects.Add<DraconnarAura>();
        }

        private class DraconnarAura: PackAuraAffect {
            public DraconnarAura(): base(RaceManager.GetRace<Races.Dragon>()) {}

            public override string Id {
                get { return AffectManager.GetCardId<Draconnar>("aura"); }
            }

            protected override Affect CreateSubAffect() {
                return new DraconnarAffect();
            }

            public override void SetAffect() {
                base.SetAffect();
                GlobalSummary.OnStartOffencePhase += DoTurn;
            }

            public override void ResetAffect() {
                base.ResetAffect();
                GlobalSummary.OnStartOffencePhase -= DoTurn;
            }

            private void DoTurn() {
                Owner.Owner.DamageDirectBy(NewDamage(DamageType.Health, 1), true);
            }
        }

        private class DraconnarAffect: SpellAffect<Draconnar> {
            public DraconnarAffect() {
                Add(new Affects.Regeneration());
            }
        }
    }
}
